package com.cplh.sharding.demo;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: kangzhijin
 * @since: 2022/10/11
 * @version: 1.0
 * @description:
 **/
@EnableScheduling
@EnableAsync
@SpringBootApplication(scanBasePackages = {"com.cplh.zhdata.sharding","com.cplh.sharding.demo"})
@MapperScan(basePackages = {"com.cplh.sharding.demo.mapper"},
        sqlSessionFactoryRef = "SqlSessionFactory")
@RestController
public class Application implements WebMvcConfigurer {

    private static Logger LOG = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
        LOG.info("--------------------------------------------------------");
        LOG.info("sharding-demo SpringBoot Start Success");
        LOG.info("--------------------------------------------------------");
    }


    @GetMapping("/sharding/demo/healthCheck")
    @ResponseBody
    public String checkServerHealth() {
        return "ok";
    }


}

